package com.example.myapplication.utli;

import android.content.Context;
import android.content.SharedPreferences;

public class SPS {

    public static boolean SaveString(Context context, String key, String value){
        SharedPreferences sharedPreferences = context.getSharedPreferences("data",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString(key,value);
        editor.commit();
        return true;
    }


    public static String getSaveString(Context context,String key){
        SharedPreferences sharedPreferences = context.getSharedPreferences("data",Context.MODE_PRIVATE);
        return sharedPreferences.getString(key,null);
    }

    public static void destory(Context context){
        SharedPreferences sharedPreferences = context.getSharedPreferences("data",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.clear();
        editor.commit();
    }

}
